*********************************
***  Trump paper - Figure 4
*** Created: 31/10/2020
*** Last updated: 21/05/2021
clear all
set scheme plottig
 

	local user = 1		/* user 1 = sergi, user 2 = Anja */

	if `user' == 1 {			// input relevant file path as per your computer

		global		main "/Users/aneundorf/Dropbox/Project_Populism/BA project/Analysis/Trump_Replication files/"
		global 		graphs 			"${main}Graphs/"
		global 		results			"${main}Results/"
	}

cd "${main}"
use "Data/US_data_recoded.dta", clear

global controls_all female age01 educ2 educ3 dom2 dom3 dom4 ethnic2 ethnic3 ethnic4 relig3 relig2


*------------------------------------------------------------
*Figure 4


reg trump_vsbiden ib4.Group##c.immig_pref $controls_all
margins, dydx(i.Group) at(immig_pref=(1(1)5))
marginsplot, yline(0) plot3opts(lc(black) mc(black)) ci3opt(lc(black)) plot1opts(lc(none) mc(none)) plot2opts(lc(none) mc(none)) ci1opt(lc(none)) ci2opt(lc(none)) legend(off) yline(0) ytitle("Marginal effect of immigration treatment", size(medlarge)) xlabel(, labsize(medsmall)) ylabel(-.5(.1).4, labsize(medsmall)) xtitle("Immigration preferences (1=open; 5=restrict)", size(medlarge)) title("") graphregion(fcolor(white) lc(black))
graph save  "${graphs}Figure4.gph",  replace
graph export  "${graphs}Figure4.pdf", as(pdf) replace
